import com.zgr.mybatis.entity.User;
import com.zgr.mybatis.mapper.UserMapper;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class UserMapperCase {

    private UserMapper userMapper;
    private AbstractApplicationContext ac;

    @Test
    public void findUser(){
        ac = new ClassPathXmlApplicationContext("spring.xml");
        userMapper = ac.getBean("userMapper", UserMapper.class);
        String username = "ff";
        User user = userMapper.findByUsername(username);
        System.out.println(user);

        ac.close();
    }
}
